{% extends  'df_user/base.html' %}
{% load static %}
{% block head %}
    <script type="text/javascript" src="{% static 'js/jquery-1.12.4.min.js' %}"></script>
    <script type="text/javascript">
        // 删除商品
        function order_del(orderid) {
            ret = confirm("你确定要删除吗？");
            if(ret) {
                url = '/order/delete' + 0 +orderid;
                var id = 0 + orderid;
                $.get(url, function(data){
                    if(data.ok == 0) {
                        alert("删除成功");
                        $("ul").remove("#" + id);
                        window.location.replace(location.href)
<!--                        $(document).ready(function () {-->
<!--            if(location.href.indexOf("#reloaded")==-1){-->
<!--            location.href=location.href+"#reloaded";-->
<!--            location.reload();-->
<!--     }-->
<!--});-->
                    }
                });

            }
        }
        $.ajaxSetup({
            data: {csrfmiddlewaretoken: '{{csrf_token}}'}
        });
    </script>
{% endblock head %}

{% block body %}
    <div class="main_con clearfix">
        <div class="left_menu_con clearfix" >
            <h3>用户中心</h3>
            <ul>
                <li><a href="/user/info">· 个人信息</a></li>
                <li><a href="/user/order1" class="active">· 全部订单</a></li>
                <li><a href="/user/site">· 收货地址</a></li>
            </ul>
        </div>
        <div class="right_content clearfix">
            <h3 class="common_title2">全部订单</h3>

            {%for g in orderlist %}
            <ul id = {{g.order_id}}">
            <ul class="order_list_th w978 clearfix" >
                <li class="col01">{{g.o_time}}</li>
                <li class="col02">订单号：{{g.order_id}}</li>
                <li class="col02 stress">{{g.o_status}}</li>
                <li class="col03"><a href="javascript:order_del({{g.order_id}});">删除</a></li>

<!--                <li class="col02 stress">{{forloop.counter}}</li>-->

            </ul>


            <table class="order_list_table w980">
                <tbody>
                    <tr>
                        <td width="55%">
                            {% for g in g.goodsdetal %}
                            <ul class="order_goods_list clearfix"  >
                                <li class="col01" ><img src="{{STATIC_URL}}{{g.goods.gpic}}"></li>
                                <li class="col02">{{g.goods.gtitle}}<em>{{g.price}}元/500g</em></li>
                                <li class="col03">{{g.count}}</li>
                                <li class="col04">{{g.sub}}元</li>
                            {% endfor%}
                            </ul>


                        </td>

                        <td width="15%">{{g.o_total}}元（含运费10元）</td>
                        <td width="15%">{{g.o_paymethod}}</td>

                        <td width="15%"><a href="#" class="oper_btn">去付款</a></td>
                    </tr>
                </tbody>
            </table>


            </ul>
            {% endfor %}


            <div class="pagenation">
                {% if pageid > 1 %}
                <a href="/user/order{{pageid|add:-1}}">上一页</a>
                {% endif %}



                {% for pindex in pindexlist %}
                <a href="/user/order{{pindex}}" {% if pindex == pageid %} class="active" {% endif %}>{{pindex}}</a>
                {% endfor %}



                {% if pageid < pindexlist|length %}
                <a href="/user/order{{pageid|add:1}}">下一页</a>
                {% endif %}
            </div>
        </div>
    </div>
{% endblock body %}

